package cn.tedu.sk.controller;

import cn.tedu.sk.entity.param.LoginInfoParam;
import cn.tedu.sk.service.LoginService;
import cn.tedu.sk.web.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/login")
public class UserLoginController {

    @Autowired
    private LoginService loginService;

    @GetMapping()
    public String test(){
        return "success";
    }

    @PostMapping()
    public ResponseResult<String> login(LoginInfoParam loginInfoParam) {
        String jwt = loginService.login(loginInfoParam);
        return new ResponseResult<String>().defaultOk(jwt);
    }


//    @GetMapping("/t/{pass}")
//    public String testt(@PathVariable String pass){
//        LoginInfoParam root = new LoginInfoParam("root", pass);
//        String login = loginService.login(root);
//        return login;
//    }


}
